#include <stdio.h>
#include <stdlib.h>
#include <glob.h>

static int errfunc(const char *epath, int eerrno)
{
  printf("%s\n", epath);
  return 0;
}

int main()
{
  glob_t pglob;

  if (glob("./*.c", 0, NULL, &pglob) != 0) {
    perror("glob");
    exit(1);
  }

  for (int i = 0; i < pglob.gl_pathc; i++) {
    printf("%s\n", pglob.gl_pathv[i]);
  }

  globfree(&pglob);

  exit(0);
}
